<template lang="html">
  <div id="editor"></div>
</template>

<script>
import WangEditor from 'wangEditor'

import '../../../../static/js/wangEditor.js'

import {loadToken} from 'common/js/cache.js'

export default {
  props: {
    content: {
      type: String,
      default: ''
    }
  },
  created() {
    this.$nextTick(() => {
      this.editor = new WangEditor('#editor')
      this.editor.customConfig.uploadImgShowBase64 = true
      this.editor.customConfig.showLinkImg = false
      this.editor.customConfig.uploadImgServer = 'https://api.zgwyzxw.cn/files/'
      this.editor.customConfig.uploadImgParams = {
        prefix: 'article'
      }
      this.editor.customConfig.uploadImgHeaders = {
        'Authorization': `Bearer ${loadToken()}\n`
      }
      this.editor.create()
      this.editor.txt.html(this.content)
    })
  }
}
</script>

<style lang="scss">

.w-e-menu{
  // z-index: 10!important;
}

.el-cascader-menus{
  z-index:200000!important;
}

.w-e-text-container{
  z-index: 1!important;
}
</style>
